import request from '@/router/axios';

export const loginByUsername = (username, password, code, randomStr) => request({
    url: '/api/system/users/login',
    method: 'post',
    data: {
        username,
        password,
        code,
        randomStr,
        clientId: 'web_api',
        clientSecret: '123456',
        appId: 'backend-manager',
        loginMode: 'std'
    }
})

export const getUserInfo = () => request({
    url: '/api/system/users/login/info',
    method: 'get'
});

export const RefeshToken = () => request({
    url: '#/user/refesh',
    method: 'post'
})

export const getMenu = (type = 0) => request({
    url: '/api/system/admin/menus/tree',
    method: 'get',
    params: {
        type_id: type
    },
    data: {
        type
    }
})

export const getMenuAll = () => request({
    url: '#/user/getMenu',
    method: 'get',
    data: {
        type: 0
    }
})

export const getTableData = (page) => request({
    url: '#/user/getTable',
    method: 'get',
    data: {
        page
    }
})

export const logout = () => true